//
// Created by imed on 2024/4/1.
//

#ifndef P2024_HYPERTHYROIDISM_SCREENING_INTERVALCONVERT_H
#define P2024_HYPERTHYROIDISM_SCREENING_INTERVALCONVERT_H
#pragma once

// platform
#include <windows.h>
#include <shellapi.h>
// io
#include <iostream>
#include <fstream>
#include <filesystem>
// err
#include <stdexcept>

// msvc dll
#define THIRD_EXTEND_API __declspec(dllexport)

// define
using namespace std::filesystem;
typedef std::pair<std::string, std::string> THIRD_EXTEND_PAIR;

namespace ThirdExtendIntervalConst{
    THIRD_EXTEND_PAIR extern SQL_NAME;
    THIRD_EXTEND_PAIR extern FROM_PATH;
    THIRD_EXTEND_PAIR extern TO_PATH;
    THIRD_EXTEND_PAIR extern DST_NAME_TEMPLATE;
    THIRD_EXTEND_PAIR extern LEFT_IDENTY;
    THIRD_EXTEND_PAIR extern RIGHT_IDENTY;
    THIRD_EXTEND_PAIR extern LOOP_INTERVAL;
}

namespace ThirdExtendIntervalConvert {
    // init module and return pid
    THIRD_EXTEND_API int initModule(std::string modulePath,
                                    std::string capturePath,
                                    std::string convertPath,
                                    bool force);
    // release py module
    THIRD_EXTEND_API bool destoryModule(int pid);
    bool genYaml(std::string yamlPath);
    int startBinary(std::string binaryPath);
    void writeStringToFile(std::ofstream &outStream, std::string key, std::string value);
    void deleteCache(path cachePath);
}


#endif //P2024_HYPERTHYROIDISM_SCREENING_INTERVALCONVERT_H
